<script setup lang="ts">
import { ref } from "vue"

const tab = ref<"work" | "history">("work")
const emit = defineEmits(["change"])
const onChange = (type: "work" | "history") => {
  tab.value = type
  emit("change", "work")
}
</script>

<template>
  <div class="tab">
    <div :class="['item', { active: tab === 'work' }]" @click="onChange('work')">工作台</div>
    <div :class="['item', { active: tab === 'history' }]" @click="onChange('history')">历史记录</div>
  </div>
</template>

<style lang="scss" scoped>
.tab {
  display: flex;
  align-items: center;
  position: absolute;
  top: 0;
  left: 30px;
  z-index: 1;
  .item {
    cursor: pointer;
    width: 111px;
    height: 40px;
    text-align: center;
    line-height: 40px;
    color: #999999;
    font-size: 14px;
    border-radius: 6px;
    margin-right: 12px;
    &.active {
      color: #333333;
      background-color: #f9f9f9;
    }
  }
}
</style>
